// 选择省市区
const state = {
    provinceIdThreeEdit: "", //省ID
    cityIdThreeEdit: "", //市Id
    areaIdThreeEdit: "", //区Id

    provinceNameThreeEdit: "", //省名字
    cityNameThreeEdit: "", //市名字
    areaNameThreeEdit: "", //区名字

    areaEditisDefault: "1", //是否为默认省市区开关
    dataDefault: {}, //默认省市区数据
};

const getters = {
    provinceIdThreeEdit: state => state.provinceIdThreeEdit,
    cityIdThreeEdit: state => state.cityIdThreeEdit,
    areaIdThreeEdit: state => state.areaIdThreeEdit,

    provinceNameThreeEdit: state => state.provinceNameThreeEdit,
    cityNameThreeEdit: state => state.cityNameThreeEdit,
    areaNameThreeEdit: state => state.areaNameThreeEdit,

    areaEditisDefault: state => state.areaEditisDefault,
    dataDefault: state => state.dataDefault,
};

const mutations = {
    // 获取省的ID
    getprovinceIdThreeEdit(state, value) {
        state.provinceIdThreeEdit = value;
    },
    // 获取市的ID
    getcityIdThreeEdit(state, value) {
        state.cityIdThreeEdit = value;
    },
    // 获取区的ID
    getareaIdThreeEdit(state, value) {
        state.areaIdThreeEdit = value;
    },

    // 获取省的名字
    getprovinceNameThreeEdit(state, value) {
        state.provinceNameThreeEdit = value;
    },
    // 获取市的名字
    getcityNameThreeEdit(state, value) {
        state.cityNameThreeEdit = value;
    },
    // 获取区的名字
    getareaNameThreeEdit(state, value) {
        state.areaNameThreeEdit = value;
    },

    // 获取默认省市区
    getDataDefault(state, value) {
        state.dataDefault = value;
    },

    // 获取是否选择默认
    getareaEditisDefault(state, value) {
        state.areaEditisDefault = value;
    },

    // 清空省和市以及区的的ID
    cleanAreaThreeEdit(state, value) {
        state.provinceIdThreeEdit = "";
        state.cityIdThreeEdit = "";
        state.areaIdThreeEdit = "";
    },

    // 清空省和市以及区的的名字
    cleanAreaThreeEditName(state, value) {
        state.provinceNameThreeEdit = "";
        state.cityNameThreeEdit = "";
        state.areaNameThreeEdit = "";
    },
    clearAll(state, value){
    },
};

const actions = {
    // 获取省市区
    getProCityAreaIdAndName({ state, commit }, value) {
        let dataDefault={
            provId:value.provId,
            cityId:value.cityId,
            areaId:value.areaId,
            provName:value.provName,
            cityName:value.cityName,
            areaName:value.areaName,
        }
        commit("getDataDefault", dataDefault);
    }
};

export default {
    state,
    getters,
    mutations,
    actions
};
